package com.heh.mybatisplus.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.heh.mybatisplus.model.BLoanInfo;
import com.heh.mybatisplus.model.Result;
import com.heh.mybatisplus.service.UserAccountService;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.core.properties.SpringDocConfigProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

/**
 * @项目名： spring-emq
 * @包名： com.heh.mybatisplus.controller
 * @文件名: UserAccountController
 * @创建者: liufudong@szyh-smart.com
 * @创建时间: 2024/10/14 15:15
 * @描述：
 */
@RestController
@Slf4j
public class UserAccountController {
    @Autowired
    private UserAccountService userAccountService;

    //http://localhost:8097/transferAccounts?fromId=1&toId=2&amount=10
    @GetMapping("/transferAccounts")
    public Result<Boolean> transferAccounts(@RequestParam Long fromId, @RequestParam Long toId,
                                            @RequestParam BigDecimal amount) throws JsonProcessingException {
        log.info("transferAccounts: fromId: {}, toId: {}", fromId, toId);
        return  (userAccountService.transferAccounts(fromId, toId,amount));
    }

}
